/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ReferencesPan.java
 *
 * Created on 8 juil. 2011, 15:28:42
 */
package app.views;

import app.controllers.Catalogue;
import app.core.IncludedPan;
import app.core.UpdatedComp;
import javax.swing.JComponent;

/**
 *
 * @author PREVROMA
 */
public class ReferencesPan extends javax.swing.JPanel implements IncludedPan {
    
    private Catalogue catalogue;

    /** Creates new form ReferencesPan */
    public ReferencesPan() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        referencesGui = new app.views.ReferencesGui();
        addReferencePan1 = new app.views.AddReferencePan();
        publicationGui1 = new app.views.PublicationGui();

        jTabbedPane1.addTab("Selectionner Références", referencesGui);
        jTabbedPane1.addTab("Ajouter une référence", addReferencePan1);
        jTabbedPane1.addTab("Publication", publicationGui1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 321, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 207, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private app.views.AddReferencePan addReferencePan1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private app.views.PublicationGui publicationGui1;
    private app.views.ReferencesGui referencesGui;
    // End of variables declaration//GEN-END:variables

    @Override
    public String getName(){
        return "Références";
    }
    
    @Override
    public void load(UpdatedComp comp) {
        comp.setText("##Chargement des References");
        catalogue.load(comp);
        comp.setText("##Fin chargement des References");
    }

    @Override
    public JComponent getComponent() {
        return this;
    }

    public void setCatalogue(Catalogue catalogue) {
        this.catalogue = catalogue;
        catalogue.addReferenceListener(this.addReferencePan1);
        catalogue.addReferenceListener(this.referencesGui);
    }
}
